import {
  PET_STATE_LIST_NO_OTHER, // todo3
  ADOPTION_SOURCE_List,
  REPORT_FLAG_LIST,
  VIDEO_STATUS_LIST,
  PET_OLD_LIST, // todo3
} from '@/const/type';
export const tableOption = () => {
  return {
    ...window.$crudMixins.tableOptions,
    addBtn: false,
    editBtn: false,
    delBtn: false,
    menuWidth: 520,
    searchLabelWidth: 120,
    column: [
      {
        label: '快照',
        prop: 'avatar',
        width: 80,
        span: 24,
        type: 'upload',
        imgFullscreen: true,
        listType: 'picture-img',
        fileType: 'img',
        rules: [
          {
            required: true,
            message: '请上传类型图片',
            trigger: 'change',
          },
        ],
      },
      {
        label: '宠物ID',
        prop: 'id',
      },
      {
        label: '宠物编号',
        prop: 'code',
        minWidth: 130,
        search: true,
        slot: true,
      },
      {
        label: '昵称/曾用名',
        prop: 'nickName',
        search: true,
        width: 150,
        overHidden: true,
        rules: [
          {
            required: true,
            message: '请输入用户名',
          },
          {
            min: 3,
            max: 20,
            message: '长度在 3 到 20 个字符',
            trigger: 'blur',
          },
        ],
      },
      {
        label: '品种',
        prop: 'petType',
        searchslot: true,
        search: true,
        // multiple: true,
        row: true,
        type: 'cascader',
        // dicUrl: '/core/classify/tree',
        width: 120,
        overHidden: true,
      },
      {
        label: '性别',
        prop: 'gender',
        type: 'select',
        search: true,
        dicUrl: '/admin/dict/type/pet_sex',
      },
      {
        label: '宠物状态',
        prop: 'status',
        search: true,
        multiple: true,
        type: 'select',
        dicData: PET_STATE_LIST_NO_OTHER, // todo3
      },
      {
        label: '展示状态',
        prop: 'reportFlag',
        search: true,
        type: 'select',
        dicData: REPORT_FLAG_LIST,
      },
      {
        label: '收养来源',
        prop: 'adoptionSource',
        type: 'select',
        dicData: ADOPTION_SOURCE_List,
      },

      {
        label: '收养日期',
        prop: 'receiveDate',
        type: 'datetime',
        format: 'yyyy-MM-dd HH:mm:ss',
        valueFormat: 'yyyy-MM-dd HH:mm:ss',
        search: true,
        width: 160,
        searchRange: true,
      },
      {
        label: '爱心收容站',
        prop: 'baseName',
        // dicUrl: '/core/base/list',
        // props: {
        //   label: 'name',
        //   value: 'id',
        // },
        overHidden: true,
        search: true,
        searchType: 'input',
        // type: 'select',
        minWidth: 130,
      },
      {
        label: '项圈编号',
        prop: 'collarNumber',
        minWidth: 130,
        search: true,
      },
      {
        label: '芯片编号',
        prop: 'chip',
        width: 160,
        overHidden: true,
      },
      {
        label: '视频转码状态',
        prop: 'videoStatus',
        type: 'select',
        width: 100,
        dicData: VIDEO_STATUS_LIST,
      },
      {
        label: '领养日期',
        prop: 'adoptionDate',
        type: 'date',
        format: 'yyyy-MM-dd',
        valueFormat: 'yyyy-MM-dd',
        width: 120,
        searchRange: true,
      },
      // {
      //   label: '是否首页推荐',
      //   prop: 'pushHomePage',
      //   search: true,
      //   type: 'select',
      //   width: 100,
      //   dicData: IS_SHOW_HOME_LIST,
      // },
      {
        label: '待完成事项',
        prop: 'matterValue',
        search: true,
        type: 'select',
        // searchslot: true,
        multiple: true,
        hide: true,
        dicUrl: '/admin/dict/type/pet_matters',
        props: {
          label: 'label',
          value: 'value',
        },
        dicFlag: true,
        dicFormatter: (data) => {
          const res = data.data;
          return res.slice(1);
        },
      },
      // todo3
      {
        label: '宠物年龄',
        prop: 'petAge',
        type: 'select',
        search: true,
        hide: true,
        dicData: PET_OLD_LIST,
      },
      {
        label: '所属区域',
        prop: 'areaIds',
        type: 'select',
        search: true,
        multiple: true,
        hide: true,
        dicUrl: '/core/cloud/adopt/area/list',
        props: {
          label: 'name',
          value: 'id',
        },
      },
      {
        label: '上架时间',
        prop: 'shelfTime',
        type: 'datetime',
        format: 'yyyy-MM-dd HH:mm:ss',
        valueFormat: 'yyyy-MM-dd HH:mm:ss',
        search: true,
        hide: true,
        width: 120,
        searchRange: true,
      },
    ],
  };
};
export const storyOption = () => {
  return {
    submitBtn: false,
    emptyBtn: false,
    group: [
      {
        label: '它的故事',
        arrow: false,
        column: [
          {
            label: '',
            span: 24,
            type: 'textarea',
            prop: 'introduction',
            showWordLimit: true,
            maxlength: 1000,
            rules: [
              {
                required: true,
                message: '请输入它的故事',
                trigger: 'blur',
              },
            ],
          },
        ],
      },
    ],
  };
};
